package com.sunyur.tailor.channel.service.inner.supplier.model;

import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @description: 供应商信息变更实体对象
 * @author: wjh
 * @time: 2021/10/13 0013 11:51
 */
@Data
public class SupplierInfoChangeModel implements Serializable {

    private static final long serialVersionUID = 7176390205008506197L;

    /**
     * 供应商Id
     */
    private Long supplierId;
    /**
     * 公司名称（供应商名称）
     */
    private String supplierName;
    /**
     * 供应商编码
     */
    private String supplierCode;
    /**
     * 事务类型
     */
    private String transactionalType;
    /**
     * 识别码
     */
    private String creditCode;
    /**
     * 识别码类型
     */
    private String creditCodeType;
    /**
     * 申请人
     */
    private String applyUser;
    /**
     * 申请人编码
     */
    private String applierCode;
    /**
     * 申请方
     */
    private String applierType;
    /**
     * 申请时间
     */
    private Date applyTime;
    /**
     * 审批状态
     */
    private String auditStatus;
    /**
     * 单据号
     */
    private String code;
    /**
     * 备注
     */
    private String remark;

    /**
     * 基本信息变更前后对比
     */
    private DiffAction baseInfoChangeData;

    /**
     * 联系人变更前后对比
     */
    private List<DiffAction> contactChangeData;

    /**
     * 银行信息变更前后对比
     */
    private List<DiffAction> bankChangeData;

    /**
     * 证照信息变更前后对比
     */
    private List<DiffAction> certificateChangeData;


    /**
     * <pre>
     *  变更对比
     * <pre>
     *
     * create by 2021/8/26 14:36
     */
    @Data
    public class DiffAction {
        /**
         * 操作 add(添加) delete(删除) update(修改)
         */
        private String action;

        /**
         * 数据域
         */
        private List<DiffField> data;
    }

    @Data
    public class DiffField {
        /**
         * 列表级操作 add 新增 update 更新 del 删除
         */
        private String operate;

        private String field;

        private Object before;

        private Object after;

        private Boolean modify;

        public DiffField(String field, Object before, Object after, Boolean modify) {
            this.field = field;
            this.before = before;
            this.after = after;
            this.modify = modify;
        }

        public DiffField(String operate) {
            this.operate = operate;
        }

    }

}
